<template>
    <div class="nav-card">
      <router-link :to="to">
        <component :is="icon" style="font-size: 18px" />
        <p>{{ text }}</p>
      </router-link>
    </div>
  </template>
  
  <script lang="ts" setup>
  import { defineProps } from 'vue';
  
  // 定义 props
  interface Props {
    icon: any; // 图标组件
    text: string; // 显示的文本
    to: string; // 路由路径
  }
  
  // 接收 props
  const props = defineProps<Props>();
  </script>
  
  <style scoped>
  .nav-card {
    width: 45%;
    background: #f5f7fa;
    border-radius: 5px;
    height: 60px;
    margin-bottom: 5px;
    padding: 10px 0px;
    text-align: center;
    transition: background-color 0.3s ease;
  }
  
  .nav-card:hover {
    background-color: #e4e7ed; /* 鼠标悬停时背景色变化 */
  }
  
  .nav-card a {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
  }
  
  .nav-card p {
    margin: 5px 0 0;
    font-size: 14px;
    color: #333;
  }
  </style>